/*
 * FileName: virtual1.cc
 * Author: 李波(Edwin Lee)
 * Date: 2024-06-04 13:28:31
 * Version: 1.0
 * Description:测试带默认值的虚函数,在多态中使用基类的默认值 
 */
#include <iostream>
using namespace std;
class Base 
{
	public:
		virtual void show(int i=10)
		{
			cout<<"call Base::show i="<<i<<endl;
		}
};

class Derive:public Base
{
	public:
		void show(int i=20)
		{

			cout<<"call Derive::show i="<<i<<endl;
		}
};

int main()
{
	Base *p = new Derive();
	p->show(); //结果是10而不是20
	p->show(50);//结果50
	delete p;
}
